home *** CD-ROM | disk | FTP | other *** search
/ Chip 2011 November / CHIP_2011_11.iso / Programy / Inne / Gry / Carnage_Contest / scripts / CC Original / movement / Kick Jump.lua < prev    next >
Encoding:
Text File  |  2010-08-09  |  1.8 KB  |  55 lines

  1. --------------------------------------------------------------------------------
  2. -- Weapon Kick Jump
  3. -- Original Carnage Contest Weapon
  4. -- Script by DC, November 2009, www.UnrealSoftware.de
  5. --------------------------------------------------------------------------------
  6.  
  7. -- Setup Tables
  8. if cc==nil then cc={} end
  9. cc.kickjump={}
  10.  
  11. -- Load & Prepare Ressources
  12. cc.kickjump.gfx_wpn=loadgfx("weapons/kickjump.png")                                -- Weapon Image
  13. setmidhandle(cc.kickjump.gfx_wpn)
  14. cc.kickjump.sfx_kickjump=loadsfx("swish.ogg")                                    -- Sound
  15.  
  16. --------------------------------------------------------------------------------
  17. -- Weapon: Kick Jump
  18. --------------------------------------------------------------------------------
  19.  
  20. cc.kickjump.id=addweapon("cc.kickjump","Kick Jump",cc.kickjump.gfx_wpn,0,2)        -- Add Weapon (0 uses, first in round 2)
  21. cc.kickjump.ammo=1                                                                -- 1 Kick Jump
  22.  
  23. function cc.kickjump.draw()                                                        -- Draw
  24.     if cc.kickjump.ammo-weapon_shots>0 then
  25.         -- HUD Crosshair
  26.         hudcrosshair(6,3)
  27.     end
  28. end
  29.  
  30. function cc.kickjump.attack(attack)                                                -- Attack
  31.     if weapon_timer>0 then
  32.         weapon_timer=weapon_timer-1
  33.     end
  34.     if (weapon_shots<cc.kickjump.ammo) and (attack==1) and (weapon_timer<=0) then
  35.         -- Use weapon and allow to use another one afterwards (1)
  36.         useweapon(1)
  37.         weapon_shots=weapon_shots+1
  38.         weapon_timer=20
  39.         -- FX
  40.         playsound(cc.kickjump.sfx_kickjump)
  41.         particle(p_muzzle,getplayerx(0),getplayery(0))
  42.         particlesize(1,1)
  43.         particlecolor(255,50,0)
  44.         particlealpha(0.5)
  45.         particlefadealpha(0.03)
  46.         -- Push (absolute, push others!)
  47.         playerpush(0,math.sin(math.rad(getplayerrotation(0)))*7.0,-math.cos(math.rad(getplayerrotation(0)))*7.0,1,1)
  48.     end
  49.     if weapon_shots>0 then
  50.         -- Avoid Falldamage
  51.         if getplayeryspeed(0)>7.0 then
  52.             playerpush(0,getplayerxspeed(0),7.0,1,0)
  53.         end
  54.     end
  55. end